﻿using CommandProcessor.Command;
using Core.Common;
using Data.Infrastructure;
using Data.Repositories;
using Domain.Commands;
using Domain.Properties;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Domain.Handlers
{
    public class CanAddBOMMachine_Details : IValidationHandler<CreateOrUpdateBOMMachine_DetailsCommand>
    {
        private readonly IBOMMachine_DetailsRepository BOMMachine_DetailsRepository;
        public CanAddBOMMachine_Details(IBOMMachine_DetailsRepository BOMMachine_DetailsRepository, IUnitOfWork unitOfWork)
        {
            this.BOMMachine_DetailsRepository = BOMMachine_DetailsRepository;
        }
        public IEnumerable<ValidationResult> Validate(CreateOrUpdateBOMMachine_DetailsCommand command)
        {
            //TODO
            //Neu Atributes (System.ComponentModel.DataAnnotations) khong thoa man cac dieu kien validation thi ban co
            //the them cac validation o day. Vd:
            if (command.ID == null)
                yield return new ValidationResult("Name", string.Format(Resources.Name));

        }


        public IEnumerable<ValidationResult> ValidateRange(IEnumerable<CreateOrUpdateBOMMachine_DetailsCommand> commands)
        {
            throw new NotImplementedException();
        }
    }
}
